package day_2022_7_to_8.day48;

/**
 * @author haomin
 * @date 2022/08/14 10:15
 **/
public class Day29_1_Num1422_MaxScore {
    class Solution {
        public int maxScore(String s) {
            int max = 0;
            char[] data = s.toCharArray();
            for(int i = 0;i < data.length-1;i++){
                int left = 0,right = 0;
                for(int j = 0;j < data.length;j++){
                    if(j <= i){
                        if(data[j] == '0') left++;
                    }else {
                        if(data[j] == '1') right++;
                    }
                }
                max = Math.max(max,left+right);
            }
            return max;
        }
    }
}